home *** CD-ROM | disk | FTP | other *** search
/ Aminet 34 / Aminet 34 (2000)(Schatztruhe)[!][Dec 1999].iso / Aminet / dev / misc / WHDLoad_dev.lha / WHDLoad / Src / slave-examples / interphase.asm next >
Encoding:
Assembly Source File  |  1999-07-29  |  5.0 KB  |  220 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    interphase.asm
  3. ;  :Contents.    Slave for "Interphase"
  4. ;  :Author.    Wepl
  5. ;  :Version.    $Id: interphase.asm 1.10 1999/07/28 21:02:45 jah Exp jah $
  6. ;  :History.    06.02.98 started
  7. ;        28.04.98 finished
  8. ;        02.05.98 flushcache inserted, now runs with cache enabled
  9. ;        15.06.98 savegame routine moved to external file
  10. ;        08.05.99 adapted for WHDLoad 10.0
  11. ;  :Requires.    -
  12. ;  :Copyright.    Public Domain
  13. ;  :Language.    68000 Assembler
  14. ;  :Translator.    Barfly V2.9
  15. ;  :To Do.
  16. ;---------------------------------------------------------------------------*
  17.  
  18.     INCDIR    Includes:
  19.     INCLUDE    whdload.i
  20.     INCLUDE    whdmacros.i
  21.  
  22.     IFD    BARFLY
  23.     OUTPUT    "wart:h-j/interphase/Interphase.Slave"
  24.     BOPT    O+ OG+                ;enable optimizing
  25.     BOPT    ODd- ODe-            ;disable mul optimizing
  26.     BOPT    w4-                ;disable 64k warnings
  27.     SUPER                    ;disable supervisor warnings
  28.     ENDC
  29.  
  30. ;============================================================================
  31.  
  32. _base        SLAVE_HEADER            ;ws_Security + ws_ID
  33.         dc.w    10            ;ws_Version
  34.         dc.w    WHDLF_Disk|WHDLF_NoError|WHDLF_EmulTrap|WHDLF_NoDivZero    ;ws_flags
  35.         dc.l    $80000            ;ws_BaseMemSize
  36.         dc.l    0            ;ws_ExecInstall
  37.         dc.w    _Start-_base        ;ws_GameLoader
  38.         dc.w    0            ;ws_CurrentDir
  39.         dc.w    0            ;ws_DontCache
  40. _keydebug    dc.b    0            ;ws_keydebug
  41. _keyexit    dc.b    $59            ;ws_keyexit = F10
  42. _expmem        dc.l    0            ;ws_ExpMem
  43.         dc.w    _name-_base        ;ws_name
  44.         dc.w    _copy-_base        ;ws_copy
  45.         dc.w    _info-_base        ;ws_info
  46.  
  47. ;============================================================================
  48.  
  49.     IFND    .passchk
  50.     DOSCMD    "WDate  >T:date"
  51. .passchk
  52.     ENDC
  53.  
  54. _name        dc.b    "Interphase",0
  55. _copy        dc.b    "1989,1990 Mirrorsoft Ltd.",0
  56. _info        dc.b    "installed & fixed by Wepl",10
  57.         dc.b    "version 1.9 "
  58.         INCBIN    "T:date"
  59.         dc.b    0
  60.     EVEN
  61.  
  62. ;============================================================================
  63. _Start    ;    A0 = resident loader
  64. ;============================================================================
  65. ;
  66. ;    Image format:
  67. ;    Disk 1        tracks 2-75 = 373760
  68. ;
  69. ;============================================================================
  70.  
  71.         lea    (_resload,pc),a1
  72.         move.l    a0,(a1)            ;save for later using
  73.  
  74.         moveq    #0,d0            ;offset
  75.         move.l    #$1c+$48c0,d1        ;size
  76.         moveq    #1,d2            ;disk
  77.         lea    $400,a0            ;destination
  78.         move.l    (_resload),a1
  79.         jsr    (resload_DiskLoad,a1)
  80.  
  81.         skip    6,$400+$98        ;dma on
  82.         ret    $400+$4532        ;vector init
  83.         patch    $400+$146,_1
  84.  
  85.         jmp    $400
  86.  
  87. _1        move.l    #$6400,d0        ;offset
  88.         move.l    #$1c+$545c6,d1        ;size
  89.         moveq    #1,d2            ;disk
  90.         move.l    $300,a0            ;destination
  91.         move.l    (_resload),a1
  92.         jsr    (resload_DiskLoad,a1)
  93.  
  94.         move.w    #$4e40,$400+$212    ;trap #0
  95.         lea    _2,a0
  96.         move.l    a0,$80
  97.  
  98.         jmp    $400+$1ae
  99.  
  100. _2        move.w    #500,$400+$129c        ;time to wait
  101.         patch    $400+$30a0,_int6c
  102.  
  103.         skip    $280-$26e,$400+$26e    ;drive stuff
  104.  
  105.         patch    $400+$2f0,_3
  106.  
  107.         jsr    $400+$114c        ;clr screen
  108.  
  109.         bsr    _waitvb
  110.         move.w    #$87d0,(_custom+dmacon)
  111.  
  112.         jsr    $400+$45e        ;original
  113.  
  114.         addq.l    #2,(2,a7)
  115.         rte
  116.  
  117. _int6c        subq.w    #1,$400+$129c
  118.         btst    #6,$bfe001
  119.         beq    .q
  120.         btst    #7,$bfe001
  121.         beq    .q
  122.         btst    #2,(_custom+potinp)
  123.         bne    .n
  124. .q        move.w    #-1,$400+$129c
  125. .n        move.w    #$20,(_custom+intreq)
  126. _rte        rte
  127.  
  128. _3        bsr    _waitvb
  129.         move.w    #$7fff,(_custom+intena)
  130.         move.w    #$7fff,(_custom+dmacon)
  131.         move.w    #$7fff,(_custom+intreq)
  132.     ;    sub.w    #10,$a08        ;ignore unwanted ports interrupts
  133.         pea    _keyint
  134.         move.l    (a7)+,$602
  135.         patch    $548a,$5a56        ;rn copylock
  136.         patch    $25f4,_savegame
  137.         patch    $2608,_loadgame
  138.  
  139.         move.l    (_resload),a0
  140.         jsr    (resload_FlushCache,a0)    ;to fix af if icache enabled
  141.  
  142.         lea    $400,a0
  143.         jmp    (a0)
  144.  
  145. ;--------------------------------
  146.  
  147. _keyint        movem.l    d0-d1/a1,-(a7)
  148.         lea    (_ciaa),a1
  149.         btst    #CIAICRB_SP,(ciaicr,a1)        ;check int reason
  150.         beq    .int2_exit
  151.         move.b    (ciasdr,a1),d0            ;read code
  152.         clr.b    (ciasdr,a1)            ;output LOW (handshake)
  153.         or.b    #CIACRAF_SPMODE,(ciacra,a1)    ;to output
  154.         not.b    d0
  155.         ror.b    #1,d0
  156.  
  157.         move.b    d0,$591
  158.         jsr    $a52
  159.  
  160.         cmp.b    (_keyexit),d0
  161.         beq    _exit
  162.  
  163.         cmp.b    #$5f,d0
  164.         bne    .1
  165.         eor.w    #$f16c,$775a            ;trainer (John Selck)
  166.         move.w    #$210,$4ec
  167. .1
  168.         moveq    #2-1,d1                ;wait because handshake min 75 µs
  169. .int2_w1    move.b    (_custom+vhposr),d0
  170. .int2_w2    cmp.b    (_custom+vhposr),d0        ;one line is 63.5 µs
  171.         beq    .int2_w2
  172.         dbf    d1,.int2_w1            ;(min=127µs max=190.5µs)
  173.  
  174.         and.b    #~(CIACRAF_SPMODE),(ciacra,a1)    ;to input
  175. .int2_exit    move.w    #INTF_PORTS,(intreq+_custom)
  176.         movem.l    (a7)+,d0-d1/a1
  177.         rte
  178.  
  179. ;--------------------------------
  180.  
  181. _loadgame    move.l    #100,d0
  182.         lea    $65000,a1        ;free mem for screen
  183.         bsr    _sg_load
  184.         move.w    #$4100,(_custom+bplcon0)
  185.         move.w    #320/8*3,(_custom+bpl1mod)
  186.     ;    move.l    #$00000eee,(color,a6)
  187.         moveq    #0,d2
  188.         rts
  189.  
  190. _savegame    move.l    #100,d0
  191.         lea    $65000,a1        ;free mem for screen
  192.         bsr    _sg_save
  193.         move.w    #$4100,(_custom+bplcon0)
  194.         move.w    #320/8*3,(_custom+bpl1mod)
  195.     ;    move.l    #$00000eee,(color,a6)
  196.         moveq    #0,d2
  197.         rts
  198.  
  199. ;--------------------------------
  200.  
  201. _waitvb        waitvb
  202.         rts
  203.  
  204. _exit        pea    TDREASON_OK
  205.         move.l    (_resload),-(a7)
  206.         add.l    #resload_Abort,(a7)
  207.         rts
  208.  
  209. ;--------------------------------
  210.  
  211. _resload    dc.l    0            ;address of resident loader
  212.  
  213. ;============================================================================
  214.  
  215.     INCLUDE    Sources:whdload/savegame.s
  216.  
  217. ;============================================================================
  218.  
  219.     END
  220.